﻿@{
    ViewBag.Title = "RptPosClassSum";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    
    @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")
    
    <div id = "DivHeader">
        <table>
            <tr>
                <td width = "70px" align="right">时间段：</td>
                <td  width = "482px">
                    @Html.Partial("~/Views/Modular/dxDateTimeRange.cshtml")
                </td>
                <td  width = "70px" align="right"></td>
                <td  width = "150px">                    
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td width ="70px" align="right">门店名称：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")                      
                </td>
                <td width = "70px" align="right">收银员：</td>
                <td width = "190px">
                    @Html.Partial("~/Views/Modular/LookupUserInfo.cshtml")
                </td>
                <td width ="70px" align="right">单据编号：</td>
                <td width ="150px">
                    <input name="FBillNo" class="mini-textbox" style="width:150px;"/>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;"pageSize="15"
            url="../Report/GetCommonReport"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="true" ondrawsummarycell="onDrawSummaryCell"
            fitColumns="false" onrowdblclick="editBill" sortMode="client">
            <div property="columns">
                <div field="FClassNo" width="120"  headerAlign="center">交班单号</div>    
                <div field="FBeginTime" width="130" dateFormat ="yyyy-MM-dd HH:mm:ss" headerAlign="center">当班时间</div> 
                <div field="FEndTime" width="130" dateFormat ="yyyy-MM-dd HH:mm:ss"  headerAlign="center">交班时间</div>                 
                <!--<div header="现金" headeralign="center">
                    <div property="columns">
                        <div field="FPayAmount0" name="FPayAmount0" width="70" headerAlign="center"align="right"numberFormat="#,0.00">零售</div>
                        <div field="FPayAmount14" name="FPayAmount14" width="70" headerAlign="center"align="right"numberFormat="#,0.00">充值</div>
                        <div field="FCashAmount" name="FCashAmount" width="70" headerAlign="center"align="right"numberFormat="#,0.00">合计</div>                            
                    </div>
                </div>     
                <div header="银行卡" headeralign="center">
                    <div property="columns">
                        <div field="FPayAmount5" name="FPayAmount5" width="70" headerAlign="center"align="right"numberFormat="#,0.00">零售</div>
                        <div field="FPayAmount15" name="FPayAmount15" width="70" headerAlign="center"align="right"numberFormat="#,0.00">充值</div>
                        <div field="FBankAmount" name="FBankAmount" width="70" headerAlign="center"align="right"numberFormat="#,0.00">合计</div>                            
                    </div>
                </div>         
                <div header="微信" headeralign="center">
                    <div property="columns">
                        <div field="FPayAmount9" name="FPayAmount9" width="70" headerAlign="center"align="right"numberFormat="#,0.00">零售</div>
                        <div field="FPayAmount16" name="FPayAmount16" width="70" headerAlign="center"align="right"numberFormat="#,0.00">充值</div>
                        <div field="FWxAmount" name="FWxAmount" width="70" headerAlign="center"align="right"numberFormat="#,0.00">合计</div>                            
                    </div>
                </div>          
                <div header="支付宝" headeralign="center">
                    <div property="columns">
                        <div field="FPayAmount8" name="FPayAmount8" width="70" headerAlign="center"align="right"numberFormat="#,0.00">零售</div>
                        <div field="FPayAmount17" name="FPayAmount17" width="70" headerAlign="center"align="right"numberFormat="#,0.00">充值</div>
                        <div field="FAliPayAmt" name="FAliPayAmt" width="70" headerAlign="center"align="right"numberFormat="#,0.00">合计</div>                            
                    </div>
                </div> -->
                <div field="FPayAmount0" name="FPayAmount0" width="100" headerAlign="center"align="right"numberFormat="#,0.00">现金.零售</div>
                <div field="FPayAmount14" name="FPayAmount14" width="100" headerAlign="center"align="right"numberFormat="#,0.00">现金.充值</div>
                <div field="FCashAmount" name="FCashAmount" width="100" headerAlign="center"align="right"numberFormat="#,0.00">现金.合计</div> 
                <div field="FPayAmount5" name="FPayAmount5" width="100" headerAlign="center"align="right"numberFormat="#,0.00">银行卡.零售</div>
                <div field="FPayAmount15" name="FPayAmount15" width="100" headerAlign="center"align="right"numberFormat="#,0.00">银行卡.充值</div>
                <div field="FBankAmount" name="FBankAmount" width="100" headerAlign="center"align="right"numberFormat="#,0.00">银行卡.合计</div>                  
                <div field="FPayAmount9" name="FPayAmount9" width="100" headerAlign="center"align="right"numberFormat="#,0.00">微信.零售</div>
                <div field="FPayAmount16" name="FPayAmount16" width="100" headerAlign="center"align="right"numberFormat="#,0.00">微信.充值</div>
                <div field="FWxAmount" name="FWxAmount" width="100" headerAlign="center"align="right"numberFormat="#,0.00">微信.合计</div>   
                <div field="FPayAmount8" name="FPayAmount8" width="100" headerAlign="center"align="right"numberFormat="#,0.00">支付宝.零售</div>
                <div field="FPayAmount17" name="FPayAmount17" width="100" headerAlign="center"align="right"numberFormat="#,0.00">支付宝.充值</div>
                <div field="FAliPayAmt" name="FAliPayAmt" width="100" headerAlign="center"align="right"numberFormat="#,0.00">支付宝.合计</div> 
                <div field="FMemberAmt" name="FMemberAmt" width="70" headerAlign="center"align="right"numberFormat="#,0.00">充值金额</div>                                       
                <div field="FPayAmount2" name="FPayAmount2" width="70" headerAlign="center"align="right"numberFormat="#,0.00">储值卡</div>
                <div field="FPayAmount3" name="FPayAmount3" width="70" headerAlign="center"align="right"numberFormat="#,0.00">购物券</div>                
                <div field="FPayAmount6" name="FPayAmount6" width="70" headerAlign="center"align="right"numberFormat="#,0.00">其它</div>                
                <div field="FPayAmount10" name="FPayAmount10" width="70" headerAlign="center"align="right"numberFormat="#,0.00">积分抵现</div>
                <div field="FPayAmount12" name="FPayAmount12" width="70" headerAlign="center"align="right"numberFormat="#,0.00">赊账</div>
                <div field="FPayAmount13" name="FPayAmount13" width="70" headerAlign="center"align="right"numberFormat="#,0.00">自定义</div>
                @*<div field="FPayAmount13" name="FPayAmount13" width="70" headerAlign="center"align="right"numberFormat="#,0.00">
                    <span id="customize">自定义</span>
                </div>*@
                <div field="FSumAmount" name="FSumAmount" width="70" headerAlign="center" align="right" numberFormat="#,0.00">小计</div>
                <div field="FPosClassType" width="100" headerAlign="center">终端类型</div>
                <div field="FStockName" width="100" headerAlign="center">门店名称</div>
                <div field="FUserName" width="80" headerAlign="center">收银员</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">
        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "FMemberAmt,FPayAmount0,FPayAmount2,FPayAmount3,FPayAmount4,FPayAmount5,FPayAmount6,"
            + "FPayAmount7,FPayAmount8,FPayAmount9,FPayAmount10,FPayAmount12,FPayAmount13,FPayAmount14,"
            + "FPayAmount15,FPayAmount16,FPayAmount17,FCashAmount,FBankAmount,FWxAmount,FAliPayAmt,FSumAmount";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDateTime1").setValue(dateToStr(nowDate, 1));
            mini.getbyName("FDateTime2").setValue(dateToStr(nowDate, 2));
            LoadData();
        }
        $(function () {
            //$("#customize").text("abs");
        });

        function clearloca() {
            mini.getbyName("FUserID").setValue("");
            mini.getbyName("FUserID").setText("");
            mini.getbyName("FUserName").setValue("");
            mini.getbyName("FStockID").setValue("");
            mini.getbyName("FStockID").setText("");
            mini.getbyName("FStockName").setValue("");
            mini.getbyName("FClassNo").setValue("");
            var nowDate = new Date();
            mini.getbyName("FDateTime1").setValue(dateToStr(nowDate, 1));
            mini.getbyName("FDateTime2").setValue(dateToStr(nowDate, 2));
            mini.getbyName("comdatasel").setValue(0);
        }

        function LoadData() {
            var cDateTime1 = mini.getbyName("FDateTime1").getFormValue();
            var cDateTime2 = mini.getbyName("FDateTime2").getFormValue();
            var mBillNo = mini.getbyName("FBillNo").getValue();
            var mCasherID = mini.getbyName("FUserID").getValue();
            var mStockID = mini.getbyName("FStockID").getValue();

            var json = "[{";
            json = json + '"mReportType":' + '"3001",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDateTime1":' + '"' + cDateTime1 + '",';
            json = json + '"mDateTime2":' + '"' + cDateTime2 + '",';
            json = json + '"mCasherID":' + '"' + mCasherID + '",';
            json = json + '"mStockID":' + '"' + mStockID + '",';
            json = json + '"mBillNo":' + '"' + mBillNo + '"';
            json = json + "}]";

            grid.load({ mydata: json }, function (data) {
                $.post("../payment/getCustomizePayName", { json: uID }, function (data) { 
                    $("#customize").text(data);
                });
            });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "零售收银汇总表");
                }
            });
        }

    </script>

    </form>
</body>
